using System;
using System.Reflection;
using Microsoft.Office.Project.EPMAuditing.Library;
using Microsoft.Office.Project.Server.Events;
using Microsoft.Office.Project.Server.Library;
using System.IO;

namespace Microsoft.Office.Project.EPMAuditing.EventHandlers
{
    public class AdminEvents : AdminEventReceiver
    {

        public override void OnAdSyncERPSynchronized(PSContextInfo contextInfo, AdSyncERPSynchronizedEventArgs e)
        {
            //DateTime now = DateTime.Now;
            //Type argType = e.GetType();
            //MemoryStream psArgs = PSSerializer<AdSyncERPSynchronizedEventArgs>.Serialize(e);
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();

        }

        public override void OnAdSyncERPSynchronizing(PSContextInfo contextInfo, AdSyncERPSynchronizingEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }
    
        public override void OnAdSyncGroupsSynchronizing(PSContextInfo contextInfo, AdSyncGroupsSynchronizingEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnAdSyncGroupsSynchronized(PSContextInfo contextInfo, AdSyncGroupsSynchronizedEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnAdSyncGroupSynchronized(PSContextInfo contextInfo, AdSyncGroupSynchronizedEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnAdSyncGroupSynchronizing(PSContextInfo contextInfo, AdSyncGroupSynchronizingEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnLineClassUpdated(PSContextInfo contextInfo, LineClassPostUpdateEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnLineClassUpdating(PSContextInfo contextInfo, LineClassPreUpdateEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnReportingPeriodUpdated(PSContextInfo contextInfo, ReportingPeriodPostUpdateEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnReportingPeriodUpdating(PSContextInfo contextInfo, ReportingPeriodPreUpdateEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnStatusReportsDeleted(PSContextInfo contextInfo, StatusReportPostDeleteEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

        public override void OnStatusReportsDeleting(PSContextInfo contextInfo, StatusReportPreDeleteEventArgs e)
        {
            AuditEvent ae = new AuditEvent(DateTime.Now, MethodBase.GetCurrentMethod().ReflectedType.Name, MethodBase.GetCurrentMethod().Name, contextInfo, e);
            ae.Post();
        }

    }




}
